<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
    <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>公众号详情</title>
    <%@ include file="top_new.jsp"%> 
</head>
<body>
<div style="padding-top: 10px;width: 98%">
    <form class="layui-form" action="<%=basePath%>release/treleaseSave" id="form">
    <input type="hidden" name="trelease.fid" id="trelease.fid" value="${trelease.fid}">
    <input type="hidden" name="isLoad" id="isLoad" value="0">
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-inline">
                <input type="text"  name="trelease.fdesc" required  lay-verify="required" placeholder="请输入公众号描述" autocomplete="off" class="layui-input" value="${trelease.fdesc}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">ftoken</label>
            <div class="layui-input-inline">
                <input type="text" name="trelease.ftoken" placeholder="请输入公众号ftoken"  required autocomplete="off" class="layui-input" value="${trelease.ftoken}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">fappId</label>
            <div class="layui-input-inline">
                <input type="text" name="trelease.fappId"  placeholder="请输入公众号fappId"  required autocomplete="off" class="layui-input" value="${trelease.fappId}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">fappSecret</label>
            <div class="layui-input-inline">
                <input type="text" name="trelease.fappSecret" placeholder="请输入公众号fappSecret"  required autocomplete="off" class="layui-input" value="${trelease.fappSecret}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">账号</label>
            <div class="layui-input-inline">
                <input type="text" name="trelease.faccount"  autocomplete="off" class="layui-input" value="${trelease.faccount}">
            </div>
        </div> 
         <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
                <input type="text" name="trelease.fpass"  autocomplete="off" class="layui-input" value="${trelease.fpass}">
            </div>
        </div>
        <div class="layui-form-item">
	    	<div class="layui-inline">
		      <label class="layui-form-label">服务条数</label>
		      <div class="layui-input-inline">
		        <input type="number" name="trelease.fecount" lay-verify="number" autocomplete="off" class="layui-input" value="${trelease.fecount}">
		      </div>
		    </div>
		    <div class="layui-inline">
		      <label class="layui-form-label">到期时间</label>
		      <div class="layui-input-block">
		       		<input class="layui-input" name="trelease.fetime" value="${trelease.fetime}" placeholder="截止日" onclick="layui.laydate({elem: this, festival: true, format: 'YYYY-MM-DD'})">
		      </div>
		    </div>
		  </div>
		  <div class="layui-form-item">
            <label class="layui-form-label">定时推送</label>
            <div class="layui-input-inline">
                 <select name="trelease.ftimer" lay-verify="required">
                    <c:forEach items="${timers}" var="s">
						<option value="${s.fode}" <c:if test="${trelease.ftimer eq s.fode}">selected="selected"</c:if>>【${s.fode}】${s.fvalue}</option>
					</c:forEach>
                </select>
            </div>
          </div> 
		  <div class="layui-form-item">
		    <label class="layui-form-label">性质</label>
		    <div class="layui-input-block">
		      <input type="radio" name="trelease.fxz" value="1" title="服务号" <c:if test="${trelease.fxz eq '1'}">checked</c:if>>
		      <input type="radio" name="trelease.fxz" value="2" title="订阅号" <c:if test="${trelease.fxz eq '2'}">checked</c:if>>
		      <input type="radio" name="trelease.fxz" value="3" title="企业号" <c:if test="${trelease.fxz eq '3'}">checked</c:if>>
		    </div>
		  </div>
        <!-- 
         <div class="layui-form-item">
            <label class="layui-form-label">性质</label>
            <div class="layui-input-block">
                <select name="trelease.fxz" lay-verify="required">
					<option value="服务号" <c:if test="${trelease.ftype eq '服务号'}">selected="selected"</c:if>>服务号</option>
					<option value="订阅号" <c:if test="${trelease.ftype eq '订阅号'}">selected="selected"</c:if>>订阅号</option>
					<option value="企业号" <c:if test="${trelease.ftype eq '企业号'}">selected="selected"</c:if>>企业号</option>
                </select>
            </div> 
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">文章类型</label>
            <div class="layui-input-block">
                <select name="trelease.ftype" lay-verify="required">
                    <c:forEach items="${tdic}" var="s">
						<option value="${s.fode}" <c:if test="${trelease.ftype eq s.fode}">selected="selected"</c:if>>【${s.fode}】${s.fvalue}</option>
					</c:forEach>
                </select>
            </div>
        </div>
          -->	
        <div class="layui-form-item">
            <label class="layui-form-label">推送标签</label>
            <div class="layui-input-block">
            	<c:forEach items="${tdic}" var="s">
            	 	<input type="checkbox" value="${s.fode}" name="trelease.ftype" title="${s.fvalue}" 
            	 	<c:if test="${fn:contains(trelease.ftype,s.fode)}" >checked</c:if>>
            	</c:forEach>
            </div>
        </div>
         <div class="layui-form-item">
		    <label class="layui-form-label">失效</label>
		    <div class="layui-input-block">
		      <input type="checkbox" name="fstats" lay-skin="switch">
		    </div>
		  </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="trelease.fremark" placeholder="请输入内容" class="layui-textarea">${trelease.fremark}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo"> 提 交 </button>
                <button type="reset" class="layui-btn layui-btn-primary"> 重 置 </button>
            </div>
        </div>
    </form>
</div>

<script>
    $(function(){
    	$("form").submit(function(){
    		var index = layer.load(2, {time: 10*1000}); //设定最长等待10秒 
    		var $form = $(this);
    		$.post($form.attr("action"), $form.serialize(), function(ret){
    			layer.close(index);
    			if (ret.isOk) {
    				$("#isLoad").val("1");
    				layer.msg("公众号信息保存成功！", {shift: 1});
    				return false;
    			} else {
    				layer.msg(ret.msg, {shift: 6});
    				return false;
    			}
    		}, "json");
    		return false;
    	});
    });
</script>
</body>
</html>